# CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
project(parallel_for)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(OpenMP REQUIRED)

add_executable(benchmark
    main.cpp
)

target_compile_options(benchmark PRIVATE ${OpenMP_CXX_FLAGS} -O3 -march=native -ffast-math)
target_link_libraries(benchmark PRIVATE ${OpenMP_CXX_FLAGS})

option(USE_ENV_THREADS "Use environment variable for thread count" ON)
if(USE_ENV_THREADS)
    add_compile_definitions(DEFAULT_THREADS=4)
endif()